package com.kamistoat.meimeistore.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.data.redis.LettuceClientConfigurationBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

// 声明Config类，同时开启事务功能
@Configuration
@EnableTransactionManagement
@MapperScan("com.kamistoat.meimeistore.product.dao")
public class MyBatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        // 如果请求页面大于最大页数，设置true则返回第一页，设置false则继续请求。默认为false
        paginationInterceptor.setOverflow(true);
        // 设置最大单页限制数量，默认为500条，设置为-1则不受限制
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }

}
